<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('表格传值给父页面')" />
</head>
<body class="gray-bg">
	 <input id="relateId" hidden>
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "normal/goods";
        var datas = [[${@dict.getType('sys_normal_disable')}]];

        $(function() {
            var options = {
                url: prefix + "/singleList",
		        showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
                columns: [{
                    radio: true
		        },
				{
					field : 'id',
					title : 'ID',
//					visible: false
				},
				{
					field : 'name',
					title : '名称'
				},
				{
					field : 'image',
					title : '展示图片',
					formatter: function(value, row, index) {
						return $.table.imageView(value,400,400);
					}
				}]
            };
            $.table.init(options);
        });

		function submitHandler(index, layero) {
            var rows = $.btTable.bootstrapTable('getSelections');
            if (rows.length == 0) {
       			$.modal.alertWarning("请至少选择一条记录");
       			return;
       		}
            var row = rows[0];
            parent.$('#relateName').val(row.name);
            parent.$('#relateId').val(row.id);
			$.modal.close();
		}
    </script>
</body>
</html>